package com.diligent.cloud.sfc.resources.impl;

import com.canny.commons.model.ListResult;
import com.canny.commons.model.ObjectResult;
import com.canny.commons.model.Result;
import com.diligent.cloud.logistics.container.model.LcmBoxFill;
import com.diligent.cloud.logistics.container.model.LcmMoveApply;
import com.diligent.cloud.logistics.container.model.LcmTransport;
import com.diligent.cloud.logistics.container.model.LcmWeightApply;
import com.diligent.cloud.sfc.resources.WorkshopTransportResource;
import com.diligent.cloud.sfc.service.WorkshopTransportService;
import org.springframework.http.ResponseEntity;
import org.springframework.web.bind.annotation.RestController;

import java.security.Principal;

/**
 * WorkshopTransportResourceImpl class
 *
 * @author xf107278
 * @date 3/28/2020
 */
@RestController
public class WorkshopTransportResourceImpl implements WorkshopTransportResource {

    private WorkshopTransportService workshopTransportService;

    public WorkshopTransportResourceImpl(WorkshopTransportService workshopTransportService) {
        this.workshopTransportService = workshopTransportService;
    }

    @Override
    public ResponseEntity<Result> searchTransport(String code, String systemId) {
        return workshopTransportService.searchTransport(code, systemId);
    }

    @Override
    public ResponseEntity<Result> addTransport(LcmTransport lcmTransport, Principal principal) {
        return workshopTransportService.addTransport(lcmTransport, principal);
    }

    @Override
    public ResponseEntity<ObjectResult> addBoxFill(LcmBoxFill lcmBoxFill, Principal principal) {
        return workshopTransportService.addBoxFill(lcmBoxFill, principal);
    }

    @Override
    public ResponseEntity<Result> addWeightApply(LcmWeightApply lcmWeightApply, Principal principal) {
        return workshopTransportService.addWeightApply(lcmWeightApply, principal);
    }

    @Override
    public ResponseEntity<Result> addMoveApply(LcmMoveApply moveApply, Principal principal) {
        return workshopTransportService.addMoveApply(moveApply, principal);
    }

    @Override
    public ResponseEntity<ListResult> getIdleBox(String machCode, Long pageIndex, Long pageSize) {
        return workshopTransportService.getIdleBox(machCode, pageIndex, pageSize);
    }
}
